<template>
  <div class="conMain" >
    <el-card  class="box-card" >

      <div slot="header" class="topfix">
          <div style="color:#ff5500;font-size: 14px;margin:0px 0px 20px;text-align: right;">请选择查询时间再进行查询，查询范围不能超过3个月</div>
          <el-form   :inline="true"  :model="params" size="small" class="goodsForm"  label-width="100px">
              <el-form-item label="员工ID">
                  <el-input clearable v-model="params.id"  placeholder="请输入员工ID" />
              </el-form-item>

              <el-form-item label="查询时间">
                  <el-date-picker
                      v-model="params.createtime"
                      type="daterange"
                      value-format="yyyy-MM-dd"
                      range-separator="至"
                      start-placeholder="开始日期"
                      end-placeholder="结束日期"
                  />
              </el-form-item>

              <el-form-item label=" ">
                <el-button type="primary"  size="small" class="searchBtn" @click="handleSearch" icon='el-icon-search'>搜索</el-button>
              </el-form-item>
          </el-form>

      </div>
      <el-table v-loading="loading"  :data="list" style="width: 100%" :empty-text='emptytxt'>
          <el-table-column prop="id" label="员工ID" align="center" width="100" />
          <el-table-column prop="name" label="员工姓名" align="center"  />
          <el-table-column prop="onum" label="下单数量" align="center"  />
          <el-table-column prop="onum_thr" label="成功订单" align="center"  />
      </el-table>
      <div class="pagination">
          <el-pagination
            :current-page="params.page"
            :page-sizes="[10]"
            :page-size="params.pagesize"
            layout="total, prev, pager, next"
            :total="total"
            @current-change="handleCurrentChange"
          />
      </div>
    </el-card>
  </div>
</template>

<script>

import { staff_yeji } from  '@/api/staff'


export default {
  data() {
    return {
      total:0,
      loading:true,
      emptytxt:'',
      list: [],
      params: {
        id:'',
        createtime:[],
        page: 1,
        pagesize:10,
      },
    }
  },
  created() {
    this.getList()
  },
  methods: {
    getList(page) {
      this.params.page = page?page:this.params.page;
      this.emptytxt='加载中...';
      this.loading=true;
      staff_yeji(this.params).then(res => {
        this.list=res.data.list
        this.total=res.data.total
        this.loading = false
        if(this.list.length==0){
          this.emptytxt='暂无数据'
        }
      })
    },
    handleSearch(){
      this.list=[];
      this.getList(1)
    },
    handleCurrentChange(val) {
        this.getList(val)
    },

  },
}
</script>

<style lang="scss" scoped>


</style>
